package com.weixing.mall.provider.model.vo.report.customer;

import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.weixing.mall.base.constant.GlobalConstant;
import com.weixing.mall.core.enums.OrderSysTagEnum;
import com.weixing.mall.provider.api.model.enums.OrderTypeEnum;
import com.weixing.mall.provider.model.enums.OrderStateEnum;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderStatusConverter;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderSysTagConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;

/**
 * @author jzy
 * @date 2020/6/3
 */
@Data
@Accessors(chain = true)
@ApiModel(value="CustomerSeckillReportVo", description="客服部-秒杀活动报表")
@ContentRowHeight(40)
public class CustomerSeckillReportVo {
    @ApiModelProperty(value = "订单Id")
    @ExcelIgnore
    private Long id;
    @ApiModelProperty(value = "商品类目id")
    @ExcelIgnore
    private Long catId;
    @ApiModelProperty(value = "下单人Id")
    @ExcelIgnore
    private Long buyerId;
    @ApiModelProperty(value = "活动Id")
    @ExcelIgnore
    private Long actId;
    @ApiModelProperty(value = "sku")
    @ExcelIgnore
    private String skuDesp;
    @ApiModelProperty(value = "商品码")
    @ExcelIgnore
    private String commodityCode;
    @ApiModelProperty(value = "商品ID")
    @ExcelIgnore
    private Long goodsId;
    @ApiModelProperty(value = "商品图片")
    @ExcelIgnore
    private String goodsImg;
    @ApiModelProperty(value = "所属客服id")
    @ExcelIgnore
    private Long customerId;

    @ExcelProperty("商品图片")
    @ColumnWidth(10)
    private URL goodsImgUrl;
    public void setGoodsImg(String goodsImg) {
        this.goodsImg = goodsImg;
        try {
            if (StrUtil.isNotEmpty(goodsImg)){
                this.goodsImgUrl=new URL(GlobalConstant.IMG_PATH_URL +goodsImg+ GlobalConstant.IMG_PATH_URL_SUFFIX);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
    @ApiModelProperty(value = "订单编号")
    @ExcelProperty("订单编号")
    private String orderSn;
    @ApiModelProperty(value = "分类")
    @ExcelProperty("分类")
    private String catName;
    @ApiModelProperty(value = "活动")
    @ExcelProperty("活动")
    private String actName;
    @ApiModelProperty(value = "货号")
    @ExcelProperty("货号")
    private String goodsSn;
    @ApiModelProperty(value = "商品名称")
    @ExcelProperty("商品名称")
    private String goodsName;
    @ApiModelProperty(value = "零售价---修改")
    @ExcelProperty("零售价")
    private BigDecimal price;
    @ApiModelProperty(value = "折扣---修改")
    @ExcelProperty("折扣")
    private BigDecimal discount;
    @ApiModelProperty(value = "折扣价格")
    @ExcelProperty("折扣价格")
    private BigDecimal discountPrice;
    @ApiModelProperty(value = "尺码")
    @ExcelProperty("尺码")
    private String size;
    @ApiModelProperty(value = "颜色")
    @ExcelProperty("颜色")
    private String color;
    @ApiModelProperty(value = "下单人")
    @ExcelProperty("下单人")
    private String buyer;
    @ApiModelProperty(value = "客户姓名")
    @ExcelProperty("客户姓名")
    private String contactUser;
    @ApiModelProperty(value = "客户手机")
    @ExcelProperty("客户手机")
    private String contactPhone;
    @ApiModelProperty(value = "客户地址")
    @ExcelProperty("客户地址")
    private String address;
    @ApiModelProperty(value = "客服名称--修改")
    @ExcelProperty("客服")
    private String customerName;
    @ApiModelProperty(value = "客服审核时间---修改")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("审核时间")
    private Date auditTime;
    @ApiModelProperty(value = "所属经销商")
    @ExcelProperty("所属经销商")
    private String distributorName;
    @ApiModelProperty(value = "所属代理")
    @ExcelProperty("所属代理")
    private String agentName;
//    @ApiModelProperty(value = "订单状态")
//    @ExcelProperty(value = "订单状态",converter = OrderStatusConverter.class)
//    private OrderStateEnum orderStatus;

    @ApiModelProperty(value = "订单状态")
    @ExcelProperty(value = "订单状态",converter = OrderSysTagConverter.class)
    private OrderSysTagEnum orderStatus;



    @ApiModelProperty(value = "代理商Id")
    @ExcelIgnore
    private Long agentId;
    @ApiModelProperty(value = "订单类型")
    @ExcelIgnore
    private OrderTypeEnum orderType;

    @ApiModelProperty(value = "所属经销商Id")
    @ExcelIgnore
    private Long distributorId;
}
